package com.yidaba.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {
	
	private static String DATABASE_NAME="yidabaNote.db";
	protected String TABLE_NOTE="NOTE";
	private static String CREATE_USER="create table USER(id integer primary key autoincrement, user varchar(100), password varchar(100), mobile varchar(100))";
	private static String CREATE_NOTE="create table NOTE(id integer PRIMARY KEY AUTOINCREMENT, title TEXT,content TEXT,img TEXT,voice TEXT, entertime TEXT)";
	private static String CREATE_METTING="create table METTING(id int , mettingtime datetime, address varchar(100), compere varchar(100), partake varchar(100),title varchar(50),content varchar(2000),img varchar(100),voice varchar(100), entertime datetime)";
	private static String CREATE_TODO="create table TODO(id int , title varchar(50),content varchar(2000), complete int ,entertime datetime)";
	private static String CREATE_REMIND="create table REMIND(id int , title varchar(50),content varchar(2000),remindtime datetime,before int,voice varchar(100) ,entertime datetime)";
	
	public DatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version){
		super( context,  name, factory, version);
	}
	
	public DatabaseHelper(Context context, int version){
		super(context,DATABASE_NAME,null,version);
		Log.i("NOTE_TABLE",CREATE_NOTE);
	}
	public DatabaseHelper(Context context){
		super(context,DATABASE_NAME,null,1);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_USER);
		db.execSQL(CREATE_NOTE);
		db.execSQL(CREATE_METTING);
		db.execSQL(CREATE_TODO);
		db.execSQL(CREATE_REMIND);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.i("DatabaseHelper.onUpgrade","DatabaseHelper.onUpgrade");
	}

	@Override
	public void onOpen(SQLiteDatabase db) {
		super.onOpen(db);
		Log.i("DatabaseHelper.onOpen","DatabaseHelper.onOpen");
	}

}
